<%@ page language="java" import="java.util.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<!DOCTYPE html>
<html  >
	<head>
		<title>工序汇报</title>
		<t:base type="jquery,easyui,tools,DatePicker,utils,yongxin_js,yongxin_css,mobile_css,mobile2_css"></t:base>
	</head>
	<style>
		._iframe{width:50%;}	
	</style>
	<script>
	 $(document).ready(function(){
		
	    var char2 = '${processReportPage.fbcph}'.charAt(0);
	    
	    if(char2 == 'S'){
	     $("#fworkshop").val('1002');
	    }
	    
       });
	
	
	
	
 	$(function(){
 	
 	
 			$.ajax({
				type : "POST",
				url : "processReportController.do?getProcess&fbcph=${processReportPage.fbcph}",
				data: {},
				success : function(jsondata) {
						data = $.parseJSON(jsondata);
						var str ="";
						$(data.obj).each(function(i,j){
							//console.log(j);
							
							str +="<span class='progress'>"+j.typename+"("+j.fbcph+")</span>";
							if(i%6==0){
								str +="<br><br>";
							}
							str +="<span >-----></span>";
							
							//console.log(str);
							
						});
						//str +=data.msg;
						
						console.log(str);
						$('#div_process').html(str);
						$('#div_nprocess').html(data.msg);
						$('#t_div_nprocess').html(data.msg);
						$('#nprocess').val('${processReportPage.nprocess}');
					}
			});
			
			var char=['A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'];
			var num = 0;
			var lastCommunAddTr = $("#record_tr");

		   $("#add_btn").click(function() {//复制一行
		         
		        document.getElementById('ftrzl').readOnly = false; 
		   		if($(".trRecord").length==1){
		   			if("${processReportPage.fbcph}".indexOf('-')>0){
		   				$("#record_tr").find("#fbcph").get(0).value +=char[num];
		   			}
		   			else{
		   				$("#record_tr").find("#fbcph").get(0).value +="-"+char[num];
		   			}
		   			
		   			num++;
		   		}
		   		
		   		
               var tr = $("#temp_tr").clone(true);
               tr.attr('id',tr.attr('id')+char[num]);
          		
          		tr.attr('class','trRecord');
           		
           		if("${processReportPage.fbcph}".indexOf('-')>0){
	   				tr.find("#fbcph").get(0).value +=char[num];
	   			}
	   			else{
	   				tr.find("#fbcph").get(0).value +="-"+char[num];
	   			}
           		
           		
               tr.insertAfter(lastCommunAddTr);
               lastCommunAddTr = tr;
               num++;
              
            });
            
            $("#del_btn").click(function() {//复制一行
              var delIndexs = new Array(0);
              $(".trRecord:gt(0)").each(function(i) {
              		
					if($(this).find("#ck").get(0).checked == true){
                  		delIndexs.splice(delIndexs.length,0,i);
                     	$(this).remove();
                     	
                    }
					 
                });
                
                
                 $(".trRecord").each(function(i) {
                	
                	if($(".trRecord").length==1){
                	    document.getElementById('ftrzl').readOnly = true;
                        $('#ftrzl').val('${processReportPage.ftrzl}');
			   			$("#record_tr").find("#fbcph").get(0).value ="${processReportPage.fbcph}";
			   			num=0;
			   			
			   		}
			   		else{
			   			if("${processReportPage.fbcph}".indexOf('-')>0){
			  				$(this).find("#fbcph").get(0).value ="${processReportPage.fbcph}"+char[i];
			  			}
			  			else{
			  				$(this).find("#fbcph").get(0).value ="${processReportPage.fbcph}-"+char[i];
			  			}
			         		
			   			
			   		}
                	
                
                 	lastCommunAddTr = $(this);
                 
                });
                
              
            });
            
            
            
            
            $("#save_btn").click(function() {            //保存操作
               top.$(".ui_state_highlight").hide();
                //保存之前判断分卷重量是否合理
	         if(!checkFJ()){
	          return false;
	         }
	         
	         /*保存之前判断产出重量是否大于投入重量*/
             if(!checkCC()){
	          return false;
	         }
	         
              	ajaxdoForm('processReportController.do?save&fstate=1','formobj');
              	$("#save_btn").hide();
              	$("#add_btn").hide();
              	$("#del_btn").hide();
            });
         selChange();   
 	})
 
   function selChange(){

	   var sel = $("#fworkshop").val();
	   $.ajax({
			type : "POST",
			url : "processReportController.do?getMatchinegroupList&process=${processReportPage.cprocess}",
			data: {pid:$('#fworkshop').val()},
			success : function(jsondata) {
					data = $.parseJSON(jsondata);
					console.log(data);
					$('#fmatchinegroup').html(data.msg);
				  	$('#fmatchinegroup').val("${processReportPage.fmatchinegroup}");
				}
		});
		
	}


 </script>
<style>
/*td{
font-family: Microsoft YaHei;font-size: 18px;
}*/

table.gridtable {font-family: verdana,arial,sans-serif;font-size:11px;color:#333333;border-width: 1px;border-color: #666666;border-collapse: collapse;}

table.gridtable th {border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #dedede;}

table.gridtable td {border-width: 1px;padding: 8px;border-style: solid;border-color: #666666;background-color: #ffffff;}


</style>
  	
<body >
	<div id="wrapper">
						<t:formvalid formid="formobj" dialog="true" usePlugin="password" layout="table" tiptype="1"
							action="processReportController.do?save&fstate=2" beforeSubmit="checkNprocessEmpty">
							<input id="id" name="id" type="hidden" value="${processReportPage.id }">
							<input type="hidden" id="cprocess" name="cprocess" class="mytxt" ignore="ignore" value="${processReportPage.cprocess}">
							<input type="hidden" id="trzl" name="trzl" value="${processReportPage.ftrzl}">
							<input type="hidden"  name="fwlname" value="${processReportPage.fwlname}">
							<table cellpadding="0" cellspacing="1" class="formtable" align="center" style="text-align: center">
								<tr>
									<td align="center" colspan=11>
										<label class="Validform_label">
											<span style="font-family: Microsoft YaHei;font-size: 18px;font-weight:5;">工序汇报单</span>
										</label>
									</td>

								</tr>
								<tr>
									<td align="center" colspan=2 style="background-color: white; padding: 20px;display:none">
										<div id="div_process2">
											<div>标准工序</div>
											<table class="gridtable">
												<tr>
													<th>工序</th>
													<th>机组</th>
													<th>工序说明</th>
												</tr>
												<tr>
													<td>粗轧</td>
													<td>1#轧机</td>
													<td>工序说明</td>
												</tr>
												<tr>
													<td>精轧</td>
													<td>1#轧机</td>
													<td>工序说明</td>
												</tr>
												<tr>
													<td>精轧</td>
													<td>1#轧机</td>
													<td>工序说明</td>
												</tr><tr>
												<td>精轧</td>
												<td>1#轧机</td>
												<td>工序说明</td>
											</tr><tr>
												<td>精轧</td>
												<td>1#轧机</td>
												<td>工序说明</td>
											</tr><tr>
												<td>精轧</td>
												<td>1#轧机</td>
												<td>工序说明</td>
											</tr><tr>
												<td>精轧</td>
												<td>1#轧机</td>
												<td>工序说明</td>
											</tr><tr>
												<td>精轧</td>
												<td>1#轧机</td>
												<td>工序说明</td>
											</tr>
											</table>

										</div>

									</td>
									<td align="center" colspan=9 style="background-color: white; padding: 20px">
										<div id="div_process"></div>

									</td>
								</tr>
								<tr style="display: none">
									<td align="center">
										<label class="Validform_label">
											制单时间
										</label>
									</td>
									<td class="value" colspan=10>
										<input class="mytxt" id="updateDate" style="width: 140px;" name="updateDate" class="mytxt" ignore="ignore"
											value="<fmt:formatDate value='${processReportPage.updateDate}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/>"
											ReadOnly>
										<!--
						<input class="Wdate" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"  style="width: 150px" id="createDate" name="createDate" class="mytxt"  ignore="ignore"
							   >
					-->
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="Validform_label">
										生产车间
										</label>
									</td>
									<td class="value" colspan=10  align="left">
										<!--<t:dictSelect field="fworkshop" typeGroupCode="workshop" hasLabel="false"  defaultVal="${processReportPage.fworkshop}" extendJson="{id:sel2}"></t:dictSelect>
									-->
									 <select  id="fworkshop"  name="fworkshop" onchange="selChange()">
								      <c:forEach items="${workshopList}" var="workshop">
								        <option value="${workshop.id}"   <c:if test="${workshop.id==processReportPage.fworkshop}"> selected="selected"</c:if>>${workshop.name}</option>
								      </c:forEach>
								     </select>
									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="Validform_label">
											班组
										</label>
									</td>
									<td class="value" colspan=10 align="left">
                                         <t:dictSelect field="fworkgroup" typeGroupCode="team" hasLabel="false"  defaultVal="${processReportPage.fworkgroup}" extendJson="{id:sel2}"></t:dictSelect>
									</td>
								</tr>

								<tr>
									<td align="center">
										<label class="Validform_label">
											机组
										</label>
									</td>
									<td class="value" colspan=10 align="left">
										 <!--<input id="fmatchinegroup" name="fmatchinegroup" style="width: 140px;" class="mytxt" ignore="ignore" value="${processReportPage.fmatchinegroup}">
									-->
									<select id='fmatchinegroup' name='fmatchinegroup' ><option value=''>请选择</option></select>
									</td>
								</tr>
									<tr>
							   <td align="center">
							   <label class="Validform_label">
										开工时间
							   </label>
							   </td>
							   	<td align="left" class="value" colspan=10>
									<input class="mytxt" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" id="startDate" name="startDate" ignore="ignore" style="width: 140px;"
										value="<fmt:formatDate value='${processReportPage.startDate}' type="date" pattern="yyyy-MM-dd HH:mm:ss"/>" >
								</td>
							</tr>
								<tr style="display: none">
									<td align="center">
										<label class="Validform_label">
											制单人
										</label>
									</td>
									<td class="value" colspan=10>
										<input id="createBy" name="createBy" style="width: 140px;" class="mytxt" ignore="ignore" readOnly
											value="${processReportPage.createBy}">

									</td>
								</tr>
								<tr>
									<td align="center">
										<label class="Validform_label">
											本厂批号
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											投入厚度
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											投入宽度
										</label>
									</td>

									<td align="center">
										<label class="Validform_label">
											投入重量
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											产出厚度
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											产出宽度
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											产出重量
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											报废重量
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											成材率
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											质量情况
										</label>
									</td>
									<td align="center">
										<label class="Validform_label">
											下一工序
										</label>
									</td>
								</tr>
								<tr id="record_tr" class="trRecord">
									<td class="value" align="center">
                                        <input type="checkbox" id="ck"  style="position: relative; top: -999em;"  >
										<input id="fbcph" name="fbcph" class="mytxt" ignore="ignore" value="${processReportPage.fbcph}" style="width: 119px;"
											ReadOnly>

									</td>
									<td align="center" class="value">

										<input id="ftrhd" name="ftrhd" class="mytxt" ignore="ignore" value="${processReportPage.ftrhd}">
									</td>
									<td align="center" class="value">
										<input id="ftrkd" name="ftrkd" class="mytxt" ignore="ignore" value="${processReportPage.ftrkd}">

									</td>
									<td align="center" class="value">
										<input id="ftrzl" name="ftrzl" class="mytxt" ignore="ignore"  Readonly value="${processReportPage.ftrzl}">

									</td>
									<td align="center" class="value">

										<input id="fcchd" name="fcchd" class="mytxt" ignore="ignore" dataType="d" value="${processReportPage.fcchd}">
									</td>
									<td align="center" class="value">
										<input id="fcckd" name="fcckd" class="mytxt" ignore="ignore" dataType="d" value="${processReportPage.fcckd}">
									</td>
									<td align="center" class="value">
										<input id="fcczl" name="fcczl" class="mytxt" ignore="ignore" dataType="d" value="${processReportPage.fcczl}">

									</td>
									<td align="center" class="value">
										<input id="fbfzl" name="fbfzl" class="mytxt" ignore="ignore" value="${processReportPage.fbfzl}" ReadOnly>

									</td>
									<td align="center" class="value">
										<input id="frate" name="frate" class="mytxt" ignore="ignore" value="${processReportPage.frate}" ReadOnly>

									</td>
									<td align="center" class="value">
										<input id="fnote" name="fnote" class="mytxt" ignore="ignore" value="${processReportPage.fnote}">

									</td>
									<td align="center" class="value">
										<div id="div_nprocess" class="div_nprocess"></div>
									</td>
								</tr>



							</table>
						</t:formvalid>
						<div id="dlg-buttons" >
							<table cellpadding="0" cellspacing="0" style="width: 100%">
								<tr>

									<td style="text-align: left; padding-top: 10px">
										<a href="#" class="easyui-linkbutton btn" iconCls="icon-save" id="save_btn">保存</a>
										<a href="#" class="easyui-linkbutton btn" iconCls="icon-add" id="add_btn">增加批号</a>
										<a href="#" class="easyui-linkbutton btn" iconCls="icon-remove" id="del_btn">删除批号</a>
									</td>
								</tr>
							</table>
					</div>


						<table style="width: 600px; display: none" cellpadding="0" cellspacing="1">

							<tr id="temp_tr">
								<td align="center" class="value" nowrap>
									<input type="checkbox" id="ck">
									<input id="fbcph" name="fbcph" class="mytxt" ignore="ignore"  ReadOnly  style="width: 119px" value="${processReportPage.fbcph}">

								</td>
								<td align="center" class="value">

									<input id="ftrhd" name="ftrhd" class="mytxt" ignore="ignore" value="${processReportPage.ftrhd}" ReadOnly>
								</td>
								<td align="center" class="value">
									<input id="ftrkd" name="ftrkd" class="mytxt" ignore="ignore" value="${processReportPage.ftrkd}">

								</td>
								<td align="center" class="value">
									<input id="ftrzl" name="ftrzl" class="mytxt" ignore="ignore" >

								</td>
								<td align="center" class="value">

									<input id="fcchd" name="fcchd" class="mytxt" ignore="ignore" dataType="d">
								</td>
								<td align="center" class="value">
									<input id="fcckd" name="fcckd" class="mytxt" ignore="ignore" dataType="d">
								</td>
								<td align="center" class="value">
									<input id="fcczl" name="fcczl" class="mytxt" ignore="ignore" dataType="d">

								</td>
								<td align="center" class="value">
									<input id="fbfzl" name="fbfzl" class="mytxt" ignore="ignore" ReadOnly>

								</td>
								<td align="center" class="value">
									<input id="frate" name="frate" class="mytxt" ignore="ignore" ReadOnly>

								</td>
								<td align="center" class="value">
									<input name="fnote" class="mytxt" ignore="ignore">

								</td>
								<td align="center" class="value">
									<div id="t_div_nprocess" class="div_nprocess"></div>
								</td>
							</tr>

						</table>
					</div>
	</body>
	
